{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# EqualFrequencyDiscretiser + WoEEncoder\n",
    "\n",
    "This is very useful for linear models, because by using discretisation + a monotonic encoding, we create monotonic variables with the target, from those that before were not originally. And this tends to help improve the performance of the linear model. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EqualFrequencyDiscretiser\n",
    "\n",
    "The EqualFrequencyDiscretiser() divides continuous numerical variables\n",
    "into contiguous equal frequency intervals, that is, intervals that contain\n",
    "approximately the same proportion of observations.\n",
    "\n",
    "The interval limits are determined by the quantiles. The number of intervals,\n",
    "i.e., the number of quantiles in which the variable should be divided is\n",
    "determined by the user.\n",
    "\n",
    "<b>Note</b>: Check out the EqualFrequencyDiscretiser notebook to larn more about this transformer."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## WoEEncoder\n",
    "\n",
    "This encoder replaces the labels by the weight of evidence.\n",
    "\n",
    "**It only works for binary classification.**\n",
    "\n",
    "<b>Note:</b> Check out the WoEEncoder notebook to learn more about this transformer."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.pipeline import Pipeline\n",
    "\n",
    "from feature_engine.discretisation import EqualFrequencyDiscretiser\n",
    "from feature_engine.encoding import WoEEncoder\n",
    "\n",
    "plt.rcParams[\"figure.figsize\"] = [15,5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load titanic dataset from OpenML\n",
    "\n",
    "def load_titanic():\n",
    "    data = pd.read_csv('https://www.openml.org/data/get_csv/16826755/phpMYEkMl')\n",
    "    data = data.replace('?', np.nan)\n",
    "    data['cabin'] = data['cabin'].astype(str).str[0]\n",
    "    data['pclass'] = data['pclass'].astype('O')\n",
    "    data['age'] = data['age'].astype('float').fillna(data.age.median())\n",
    "    data['fare'] = data['fare'].astype('float').fillna(data.fare.median())\n",
    "    data['embarked'].fillna('C', inplace=True)\n",
    "    data.drop(labels=['boat', 'body', 'home.dest', 'name', 'ticket'], axis=1, inplace=True)\n",
    "    return data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>pclass</th>\n",
       "      <th>survived</th>\n",
       "      <th>sex</th>\n",
       "      <th>age</th>\n",
       "      <th>sibsp</th>\n",
       "      <th>parch</th>\n",
       "      <th>fare</th>\n",
       "      <th>cabin</th>\n",
       "      <th>embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>female</td>\n",
       "      <td>29.0000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>211.3375</td>\n",
       "      <td>B</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>male</td>\n",
       "      <td>0.9167</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>151.5500</td>\n",
       "      <td>C</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>female</td>\n",
       "      <td>2.0000</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>151.5500</td>\n",
       "      <td>C</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>male</td>\n",
       "      <td>30.0000</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>151.5500</td>\n",
       "      <td>C</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>female</td>\n",
       "      <td>25.0000</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>151.5500</td>\n",
       "      <td>C</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  pclass  survived     sex      age  sibsp  parch      fare cabin embarked\n",
       "0      1         1  female  29.0000      0      0  211.3375     B        S\n",
       "1      1         1    male   0.9167      1      2  151.5500     C        S\n",
       "2      1         0  female   2.0000      1      2  151.5500     C        S\n",
       "3      1         0    male  30.0000      1      2  151.5500     C        S\n",
       "4      1         0  female  25.0000      1      2  151.5500     C        S"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = load_titanic()\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X_train : (916, 8)\n",
      "X_test : (393, 8)\n"
     ]
    }
   ],
   "source": [
    "# let's separate into training and testing set\n",
    "X = data.drop(['survived'], axis=1)\n",
    "y = data.survived\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)\n",
    "\n",
    "print(\"X_train :\" ,X_train.shape)\n",
    "print(\"X_test :\" ,X_test.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA20AAAE/CAYAAADVKysfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3df7Bc913e8fcTORjjBGLj+I4qaSKXakLsuLHpHZFOWriJ01iJGWQ6445SQ+Riqv5witPRDMgwQ6CtZtw/TGECBkSSRjMxMWrAtSZOIR4ltymdEMdOHGzZca3EwlakWpAfODelpjKf/nGPYFGurPtzz3d3368Zze5+7zm7z/n6Smcfn7NnU1VIkiRJktr0kr4DSJIkSZLOztImSZIkSQ2ztEmSJElSwyxtkiRJktQwS5skSZIkNczSJkmSJEkNs7RJkiSpCUleneRzSb6R5Cf7ziO14ry+A0iSJEmdnwJmq+rqvoNILfFImyRJklrxKuDwUldK4oEIjTVLm7QMSfYk+WJ3+sZjSX6kG1+X5I4kf5rkqSTvTFKndyZJvivJ+5KcSPLlJP8hybp+t0aSpP4l+TjwRuBXkswlubU7VfK5JM8k+fmBZTd3+9ebkzwNfLwb//Ekjyf5WpLfT/KqfrZGWl2WNml5vgj8Q+C7gF8APphkPfDPgbcCVwHfB1x/xnr7gVPA3wGuBt4C/MSQMkuS1KyqehPwP4B3VtXLgM8D7wBeAVwH/KskZ+5XfxB4DXBt97OfAf4x8MruuT40pPjSmkpV9Z1BGnlJHgbeDdwK/HZV/UY3/mbgfuClwHcDTwOvqKo/737+dmBXVb2xl+CSJDUkySzwwap67wI/+yWgqurfJtkMPAV8T1V9qfv5fwM+XFXv6x6/BJgDXlNVfzycLZDWhkfapGVI8o4kDyf5epKvA68FLgH+FvDMwKKD91/FfHk7MbDebwCXDiu3JEmjIsn3J/lEkj9J8mf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LjNwVLfl4zb9gNLfo8z1DkY9dL2GWBLksu6/yu9AzjYc6bFOgjs7O7vBO7tMcvfkCTMfwbo8ar6xYEftZz5lUle0d2/AHgz8AUazVxVt1XVxqrazPzv7cer6kdpNO9pSS5M8vLT94G3AI/SaO6q+t/AM0le3Q1dAzxGo3nP8Hb++tRIGI3MGi+jvI9dDWf7O3cQ2JHk/CSXAVuAB3rIt2qWsd8fxzlY6vuIsZqDZbwvGavth2W9xxnuHFTVSP8B3gb8L+CLwM/2necsGT8EnAD+H/Ot/Gbgu5m/As2T3e3FfeccyPsPmD+8+0fAw92ftzWe+e8Cn+syPwr8XDfebOaB7DPAR0YhL/OfEft89+fw6b9zLedm/ipgD3a/G/8VuKjlvF3m7wC+AnzXwFjTmf0znn9GYR+7Stu5pP008LPdnDwBvLXv/Kuw/Uve7/y3fO4AAABoSURBVI/hHCz5fcS4zcHAdi3qfcm4bf9y3uMMcw7SvaAkSZIkqUGjfnqkJEmSJI01S5skSZIkNczSJkmSJEkNs7RJkiRJUsMsbZIkSZLUMEubJEmSJDXM0iZJkiRJDbO0SZIkSVLD/j+UgSC64ypSUwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 1080x360 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# we will use two continuous variables for the transformations\n",
    "X_train[[\"age\", 'fare']].hist(bins=30)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(memory=None,\n",
       "         steps=[('EqualFrequencyDiscretiser',\n",
       "                 EqualFrequencyDiscretiser(q=4, return_boundaries=False,\n",
       "                                           return_object=True,\n",
       "                                           variables=['age', 'fare'])),\n",
       "                ('WoEEncoder', WoEEncoder(variables=['age', 'fare']))],\n",
       "         verbose=False)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# set up the discretiser\n",
    "\n",
    "efd = EqualFrequencyDiscretiser(\n",
    "    q=4,\n",
    "    variables=['age', 'fare'],\n",
    "    # important: return values as categorical\n",
    "    return_object=True)\n",
    "\n",
    "# set up the encoder\n",
    "woe = WoEEncoder(variables=['age', 'fare'])\n",
    "\n",
    "# pipeline\n",
    "transformer = Pipeline(steps=[('EqualFrequencyDiscretiser', efd),\n",
    "                              ('WoEEncoder', woe),\n",
    "                              ])\n",
    "\n",
    "transformer.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'age': [-inf, 23.0, 28.0, 35.0, inf],\n",
       " 'fare': [-inf, 7.8958, 14.4542, 31.275, inf]}"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transformer.named_steps['EqualFrequencyDiscretiser'].binner_dict_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'age': {0: 0.07533270507296917,\n",
       "  1: -0.260402163917158,\n",
       "  2: 0.3237107275657203,\n",
       "  3: 0.05769015189511875},\n",
       " 'fare': {0: -0.5990108946387251,\n",
       "  1: -0.41504696424627724,\n",
       "  2: 0.142571903020815,\n",
       "  3: 0.7852653023249282}}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transformer.named_steps['WoEEncoder'].encoder_dict_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>pclass</th>\n",
       "      <th>sex</th>\n",
       "      <th>age</th>\n",
       "      <th>sibsp</th>\n",
       "      <th>parch</th>\n",
       "      <th>fare</th>\n",
       "      <th>cabin</th>\n",
       "      <th>embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1139</th>\n",
       "      <td>3</td>\n",
       "      <td>male</td>\n",
       "      <td>0.057690</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.599011</td>\n",
       "      <td>n</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>533</th>\n",
       "      <td>2</td>\n",
       "      <td>female</td>\n",
       "      <td>0.075333</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.142572</td>\n",
       "      <td>n</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>459</th>\n",
       "      <td>2</td>\n",
       "      <td>male</td>\n",
       "      <td>0.057690</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.142572</td>\n",
       "      <td>n</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1150</th>\n",
       "      <td>3</td>\n",
       "      <td>male</td>\n",
       "      <td>-0.260402</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.142572</td>\n",
       "      <td>n</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393</th>\n",
       "      <td>2</td>\n",
       "      <td>male</td>\n",
       "      <td>-0.260402</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.785265</td>\n",
       "      <td>n</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     pclass     sex       age  sibsp  parch      fare cabin embarked\n",
       "1139      3    male  0.057690      0      0 -0.599011     n        S\n",
       "533       2  female  0.075333      0      1  0.142572     n        S\n",
       "459       2    male  0.057690      1      0  0.142572     n        S\n",
       "1150      3    male -0.260402      0      0  0.142572     n        S\n",
       "393       2    male -0.260402      0      0  0.785265     n        S"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_t = transformer.transform(X_train)\n",
    "test_t = transformer.transform(X_test)\n",
    "\n",
    "test_t.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbkAAAFNCAYAAACdVxEnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3dd3yV9d3/8dcnCWHvsCEksofMyLa3A62zatU6oUoVd+1tbbX3ba1tbbV2qFVbb7SIDEXqwm21rspQwhQQFAhh770zPr8/zkV/aUzIAXJynZzzfj4eeeRc87y/Z33ONb7XMXdHREQkEaWEHUBERCRWVORERCRhqciJiEjCUpETEZGEpSInIiIJS0VOREQSloqcHDMz+8jMrjvGZTPNbI+ZpVZ2rhL3cZ+ZTTzC9EVmdsoxrtvNrOMxh4tzZnaRma0OnqO+Yec5Gon+3MjRUZFLcma20sz2Bx9mG8xsnJnVi9H9DD887O6r3L2euxdV9n1Fy917uPtHVX2/1eRD+A/ArcFzNDfsMJXleL6YJcL9JyMVOQE4393rAX2AvsDPQs4j4WsPLDqWBc0srZKzxI1EbluiUpGTf3P3DcC7RIodAGY2yMymm9kOM5tf3u49M+tgZh+Y2VYz22Jmk8ysUTBtApAJvB5sM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mW0bQF+QuSL+UIiu/VDz32Mr7HWwD+C98tC4OpjvS9d8URERBJWMu2uFBGRJKMiJyIiCUtFTkREEpaKnIiIJCwVORERSVgqciJxysx+GPzywqSws4hUV+pCIBKnzGwJkSuK5EUxb5q7H9MFbEUSWUJd1kskUZjZk0QuGP6amU0kcpX22sB+4Fp3X2pm1xD5lYlaQF0zOx94DDiRyHv7Pnf/xhVkRJKJtuRE4pSZrSRybcVDwD53LzSz4cBN7n5xUOTuB3q5+zYz+y2w2N0nmlkjItf56+uRaxmKJCVtyYnEv4bAs2bWicjlzWqUmPaeu28Lbp9J5KLcdwbDtYBM4vP6hSJVQkVOJP79GvjQ3S8Kfk/voxLTSm6lGXCxuy+tumgi8U1nV4rEv4bA2uD2NUeY713gtuBXGzCzvjHOJRL3VORE4t9DwANmNg1IPcJ8vyayK3OBmS0MhkWSmk48ERGRhKUtORERSVgqciIikrBU5EREJGGpyImISMJSkRMRkYSlIiciIglLRU5ERBKWipyIiCSs/wdoWNiEVjBCaAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# let's explore the monotonic relationship\n",
    "plt.figure(figsize=(7,5))\n",
    "pd.concat([test_t,y_test], axis=1).groupby(\"fare\")[\"survived\"].mean().plot()\n",
    "plt.title(\"Relationship between fare and target\")\n",
    "plt.xlabel(\"fare\")\n",
    "plt.ylabel(\"Mean of target\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note how now the intervals are monotonically sorted respect to the target."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "fengine",
   "language": "python",
   "name": "fengine"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
